#!/usr/bin/python
#-*- coding: utf-8 -*-

import sys
reload(sys)
sys.setdefaultencoding('utf8')

import MySQLdb
from redis.client import Redis
import conf

#mysql connection
def db_connect():
    try:
        conn = MySQLdb.connect(**conf.db_info)
        cur = conn.cursor()
        return conn, cur
    except Exception as e:
        raise e

#redis connection
def redis_connect():
    try:
        conn = Redis(**conf.redis_info)
        return conn
    except Exception as e:
        raise e
